<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<?php
require_once("../../conn/conn_db.php");

if( $_POST["txt_name"]!="" && $_POST["txt_pwd"]!="" ) 
{
    
    $name = $_POST["txt_name"]; 
    $pwd = $_POST["txt_pwd"];     
    
    $sql = "select * from admin_info where a_name='$name' and a_pwd='$pwd'"; 
    $result = $conn->query($sql);
    
    if ($result->num_rows > 0) {
        session_start();               
        $_SESSION['user'] = $_POST['txt_name'];
        echo "<script> self.location='../main.php';</script>";  
    }
    else   
    {
        echo "<script>alert('用户名或密码错误，请重试！');self.location='../login.php'</script>";
    }
}
else  
{
    echo "<script>alert('请输入用户名和密码！');self.location='../login.php'</script>";
}
?>
</body>
</html>